﻿namespace NorthernLights.UnitTests.Classes
{
    using System.Runtime.Serialization;
    using System.Collections;
    using System.Collections.Generic;

    [DataContract]
    public class MockObject : IComparer<MockObject>
    {
        public MockObject(string firstName, string lastName)
        {
            this.FirstName = firstName;
            this.LastName = lastName;
        }

        [DataMember]
        public string FirstName { get; set; }

        [DataMember]
        public string LastName { get; set; }

        public int Compare(MockObject x, MockObject y)
        {
            if (string.Compare(x.FirstName, y.FirstName) == 0)
            {
                if (string.Compare(x.LastName, y.LastName) == 0)
                {
                    return 0;
                }
            }

            return -1;
        }

        public override bool Equals(object obj)
        {
            MockObject x = this;
            MockObject y = obj as MockObject;

            if (y != null)
            {
                if (Compare(x, y) == 0)
                {
                    return true;
                }
            }

            return false;
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
